<template>
  <el-container>
    <el-aside width="200px">
      <img style="width:114px;margin:20px 0 12px 42px" src="@/assets/Index/微摄logo.png" alt />
      <div class="userHeader">
        <div class="userHeadBox">
          <img style="width:70px" src="@/assets/Index/userHead.png" alt />
        </div>
        <p class="userNick">忠坤是傻子</p>
        <p class="userInt">这是一段用户的介绍</p>
      </div>
      <!-- 这里是导航侧边栏 -->
      <el-row class="tac">
        <el-menu
          :default-active="defaultActive"
          style="border:0"
          :unique-opened="unique"
          class="el-menu-vertical-demo"
          background-color="#262626"
          text-color="#ADB1AF"
          active-text-color="#fff"
        >
          <!-- 一栏 -->
          <el-menu-item index="5"  @click="goHome">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <!-- 一栏 -->
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span>杨孺青</span>
            </template>
            <el-menu-item index="1-1" @click="Yang1">商品列表</el-menu-item>
            <el-menu-item index="1-2" @click="Yang2">商品分类</el-menu-item>
          </el-submenu>
          <!-- 二栏 -->
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-s-shop"></i>
              <span>凌兴龙</span>
            </template>
            <el-menu-item index="1-1" @click="Ling1">Page1</el-menu-item>
            <el-menu-item index="1-2" @click="Ling2">Page2</el-menu-item>
          </el-submenu>
          <!-- 三栏 -->
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-s-help"></i>
              <span>王乐明</span>
            </template>
            <el-menu-item index="1-1" @click="Wang1">Page1</el-menu-item>
            <el-menu-item index="1-2" @click="Wang2">Page2</el-menu-item>
          </el-submenu>
          <!-- 四栏 -->
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-s-shop"></i>
              <span>张忠坤</span>
            </template>
            <el-menu-item index="1-1" @click="Zhang1">Page1</el-menu-item>
            <el-menu-item index="1-2" @click="Zhang2">Page2</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-row>
      <!-- 侧边导航栏结束 -->
      
    </el-aside>
    <el-container>
      <el-header hight="60px">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item v-for="(item,index) in routeMatch" :key='index' :to="{ path: item.path }">{{item.name}}</el-breadcrumb-item>
        </el-breadcrumb>
      </el-header>
      <el-main>
        <div class="mainBox">
          <router-view></router-view>
        </div>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      unique: true,
      defaultActive: window.location.pathname,
      routeMatch:[],
    };
  },
  methods: {
    goHome() {
      this.$router.push({
        path: "/index2",
      });
    },
    Yang1() {
      this.$router.push({
        path: "/YangPage1",
      });
    },
    Yang2() {
      this.$router.push({
        path: "/YangPage2",
      });
    },
    Ling1() {
      this.$router.push({
        path: "/LingPage1",
      });
    },
    Ling2() {
      this.$router.push({
        path: "/LingPage2",
      });
    },
    Wang1() {
      this.$router.push({
        path: "/WangPage1",
      });
    },
    Wang2() {
      this.$router.push({
        path: "/WangPage2",
      });
    },
    Zhang1() {
      this.$router.push({
        path: "/ZhangPage1",
      });
    },
    Zhang2() {
      this.$router.push({
        path: "/ZhangPage2",
      });
    },
    routeM(){
      this.routeMatch = this.$route.matched
      this.routeMatch.splice(0,1)
      console.log(this.routeMatch);
    }
  },
  created(){
    this.routeM()
    console.log(this);
  },
  // watch:{
  //   $route:{
  //     changeRoute(){
  //       this.routeM()
  //     },
  //   }
  // },
};
</script>

<style>
body,
html {
  background-color: #ecf0f3;
  height: 100%;
  width: 100%;
}
.el-header {
  background-color: #fff;
  line-height: 60px;
  color: #666;
  font-size: 14px;
}
.el-aside {
  height: 100%;
  background-color: #262626;
}

.el-container {
  height: 100%;
}
.el-main {
  padding: 14px 14px 0 14px;
  box-sizing: border-box;
  position: relative;
}
.userHeader {
  background: url("../assets/Index/headerbg.png");
  width: 200px;
  height: 236px;
  padding: 52px 0 0 0;
  box-sizing: border-box;
  text-align: center;
}
.userHeadBox {
  width: 76px;
  height: 76px;
  background-color: rgba(255, 255, 255, 0.3);
  padding: 3px;
  box-sizing: border-box;
  border-radius: 50%;
  margin-left: 63px;
}
.userNick {
  line-height: 30px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.userInt {
  line-height: 20px;
  font-size: 12px;
  color: rgb(249, 249, 249);
}
.mainBox {
  padding: 30px;
  box-sizing: border-box;
  background-color: #fff;
  width: 98%;
  position: absolute;
  top: 14px;
}
.el-breadcrumb {
  line-height: 60px;
}

</style>